﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using AnesSystem.ViewModels;
using AnesSystem.Models;


namespace AnesSystem.Controls
{
    /// <summary>
    /// EventAndDrugWinxaml.xaml 的交互逻辑
    /// </summary>
    public partial class EventAndDrugDialogCtrl : UserControl
    {

        #region Variables

        private static EventAndDrugDialogCtrl _instance;

        #endregion

        #region Constructor
        public EventAndDrugDialogCtrl()
        {
            InitializeComponent();
            this.DataContext = EventAndDrugWinViewModel.Instance;
        }

        #endregion

        #region Properties

        public EventAndDrug EventAndDrug
        {
            get
            {
                return EventAndDrugWinViewModel.Instance.EventAndDrug;
            }
            set
            {
                EventAndDrugWinViewModel.Instance.EventAndDrug = value;

            }
        }
        public bool IsAutoShow
        {
            get
            {
                return EventAndDrugWinViewModel.Instance.IsAutoShow;
            }
            set
            {
                refCmb();
                EventAndDrugWinViewModel.Instance.IsAutoShow = value;
            }
        }
        

        public static EventAndDrugDialogCtrl Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new EventAndDrugDialogCtrl();
                }
                return _instance;
            }
        }

        #endregion

        #region 依赖属性
      

        #endregion

        #region Event

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string commond = (sender as Button).Tag.ToString();
            EventAndDrugWinViewModel.Instance.Excute(commond);
        }
        private void refCmb()
        {
            (_eventComBox as CustomEventCmbCtrl).Refresh();
        }

        #endregion


    }
}
